package org.itzixi.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.itzixi.pojo.FriendRequest;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.itzixi.pojo.bo.NewFriendRequestBO;
import org.itzixi.pojo.vo.NewFriendsVO;
import org.springframework.stereotype.Repository;

/**
 * <p>
 * 好友请求记录表 Mapper 接口
 * </p>
 *
 * @author 顾文龙
 * @since 2024-06-12
 */
@Repository
public interface FriendRequestMapper extends BaseMapper<FriendRequest> {


    default void deleteHistoryByMyIdAndFriend(NewFriendRequestBO newFriendRequestBO){
        QueryWrapper<FriendRequest> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(FriendRequest::getMyId, newFriendRequestBO.getMyId())
                .eq(FriendRequest::getFriendId, newFriendRequestBO.getFriendId());
        this.delete(queryWrapper);
    }


    Page<NewFriendsVO> queryNewFriendList(@Param("page") Page<NewFriendsVO> page, @Param("userId") String userId);
}
